#include <Entity.h>
#include <View.h>

    /********************************/
    /*          Members             */
    /********************************/

        /********************************/
        /*          Methods		        */
        /********************************/
		
			void Entity::Update()
			{

			}
			
			void Entity::Display()
			{
                if(m_Mesh!=NULL)
                {
                    GLSLProgram::Use(m_GLSLProgram);
                    View::MainView->SendMatrix(m_GLSLProgram);
                    glUniformMatrix4fv(glGetUniformLocation(m_GLSLProgram, "u_ModelMatrix"), 1, GL_TRUE, m_Transform.ReturnModelMatrix().array);
                    m_Mesh->Display();
                    GLSLProgram::Disable();
                }
			}
			
	/********************************/
    /*          Static             */
    /********************************/

		/********************************/
        /*          Properties		    */
        /********************************/
			
            Entity * Last;           /*!< Last Entity inside the Entities container	*/
            Entity * First;          /*!< First Entity inside the Entities container	*/
			
            std::vector<Entity *> Entity::Entities;
			
		/********************************/
        /*          Methods		        */
        /********************************/
		
            Entity * Entity::New()
			{
				Entity * entity = new Entity();
				Entities.push_back(entity);
                return entity;
			}
			
            Entity * Entity::New(Mesh * mesh)
			{
				Entity * entity = new Entity();
				Entities.push_back(entity);
				entity->m_Mesh = mesh;

                return entity;
			}
			
			void Entity::Remove(Entity * entity)
			{
			
			}
			
			void Entity::Remove(int id)
			{
			
			}

            Entity & Entity::First()
            {
                return *Entities.front();
            }

            Entity & Entity::Last()
            {
                return *Entities.back();
            }
			
	/********************************/
	/*          Constructors		*/
	/********************************/

		Entity::Entity()
		{

		}




